package com.bo.sina.send;

import java.util.List;

public class WeiboResponse {
	private List<String> cookieList;
	private String message;
	
	
	
	
	public WeiboResponse(String message) {
		super();
		this.message = message;
	}
	
	
	
	public WeiboResponse(List<String> cookieList, String message) {
		super();
		this.cookieList = cookieList;
		this.message = message;
	}



	public List<String> getCookieList() {
		return cookieList;
	}



	public void setCookieList(List<String> cookieList) {
		this.cookieList = cookieList;
	}



	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public String getSession(){
		if(cookieList!=null){
			StringBuffer sb=new StringBuffer("");
			for(String s:cookieList){
				if(s.indexOf("SUP=")!=-1){
					sb.append(s.substring(0, s.indexOf(";")+1));
				}else if(s.indexOf("SUE=")!=-1){
					sb.append(s.substring(0, s.indexOf(";")+1));
				}else if(s.indexOf("SUS=")!=-1){
					sb.append(s.substring(0, s.indexOf(";")+1));
				}else if(s.indexOf("sso_info=")!=-1){
					sb.append(s.substring(0, s.indexOf(";")+1));
				}
			}
			if(!sb.toString().equals("")){
				return sb.toString();
			}
		}
//		return cookie.substring(0, cookie.indexOf(";")); 
		return null;
	}



	@Override
	public String toString() {
		return "WeiboResponse [cookieList=" + cookieList + ", message="
				+ message + "]";
	}
	
	
	
}
